package com.stylefeng.guns.command.impl;

import java.util.concurrent.ConcurrentHashMap;

public class CommandContext {

    private CommandContext() {

    }

    private static ConcurrentHashMap<String, Thread> commandMap = new ConcurrentHashMap<>();


    public static Thread getCommand(String key) {
        return commandMap.get(key);
    }

    public static Thread removeCommand(String key) {
        return commandMap.remove(key);
    }

    public static boolean setCommand(String key, Thread command) {
        return commandMap.putIfAbsent(key, command) != null;
    }


}
